<template>
  <view class="container">
    <view class="form">
      <view class="form-item">
        <text class="label">姓名</text>
        <input class="input" type="text" placeholder="请输入姓名" v-model="name" />
      </view>
      <view class="form-item">
        <text class="label">性别</text>
        <picker @change="bindPickerChange" :value="index" :range="array">
          <view class="uni-input">{{array[index]}}</view>
        </picker>
      </view>
      <view class="form-item">
        <text class="label">年龄</text>
        <input class="input" type="number" placeholder="请输入年龄" v-model="age" />
      </view>
	  <view class="form-item">
	    <text class="label">身高</text>
	    <input class="input" type="number" placeholder="请输入身高" v-model="age" />
	  </view>
	  <view class="form-item">
	    <text class="label">体重</text>
	    <input class="input" type="number" placeholder="请输入体重" v-model="age" />
	  </view>
      <button class="button" type="primary" @tap="submit">确定</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      name: "",
      gender: "男",
      age: "",
      array: ['男', '女'],
      index: 0,
	  height:"",
	  weight:""
    };
  },
  methods: {
    bindPickerChange: function(e) {
      console.log('picker发送选择改变，携带值为', e.detail.value)
      this.index = e.detail.value
      if (e.detail.value == 1) {
        this.gender = "女";
      } else {
        this.gender = "男";
      }
    },
    submit() {
      // TODO: add your logic to handle the form submission
      console.log(this.name, this.gender, this.age);
    },
  },
};
</script>

<style>
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50rpx;
  background-color: #f5f5f5;
}

.form {
  width: 100%;
  background-color: #ffffff;
  padding: 20rpx;
  border-radius: 10rpx;
  box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}

.form-item {
  display: flex;
  align-items: center;
  margin-bottom: 30rpx;
}

.label {
  width: 100rpx;
  font-size: 32rpx;
  color: #333;
}

.input {
  flex: 1;
  height: 60rpx;
  font-size: 28rpx;
  border: none;
  border-bottom: 1rpx solid #ccc;
  padding: 0 10rpx;
}

.button {
  width: 100%;
  height: 80rpx;
  font-size: 32rpx;
  border-radius: 20rpx;
  margin-top: 40rpx;
  background: #2796f2;
  color: #79787c;
  border: none;
}
</style>
